<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>电影列表</title>
    <%- include common %>
</head>
<body>
    <%- include("head",{title:"movie",username}) %>
    <div class="container container-fluid">
        <div class="row" >
            <h2 class="text-success">电影列表</h2>
        </div>

        <div class="row">
            <div class="col-md-4 col-sm-4 col-lg-4">
                <button class="btn btn-info" onclick="location.href='/movie?year=1'">年份升序</button>
                <button class="btn btn-dagner"  onclick="location.href='/movie?year=-1'" >年份降序</button>
                <button class="btn btn-warning" onclick="location.href='/movie?rating.average=1'" >评分升序</button>
                <button class="btn btn-success" onclick="location.href='/movie?rating.average=-1'" >评分降序</button>
            </div>
        </div>

        <div class="row" style="margin-top: 20px;">
            <div class="col-md-4 col-sm-4 col-lg-4" style="display: flex;">
                <input type="text" id="keyword" class="from-control" placeholder="请输入关键词">
                <button class="btn btn-info" onclick="todoSearch()" >点击搜索</button>
            </div>
        </div>

        <div class="row"  style="margin-top:20px">
         <%   result.forEach((item,i)=>{ %>
            <div class="col-md-3 col-sm-3 col-lg-3">
                <div class="thumbnail">
                    <img src="<%- item.images.large.replace(/img7/,'img3') %>" alt="" style="height:320px;width: 100%">
                    <div>
                        <h4 class="pull-right"><%- item.year %></h4>
                        <h4 class="text-danger"><%- item.title %> </h4>
                        <p class="text-success">评分：<%- item.rating.average %></p>
                        <p class="text-primary">分类：<%- item.genres %></p>
                        <p class="text-primary">导演：<%- item.directors[0].name %></p>
                    </div>
                    <button onclick="location.href='/comment/index?mid=<%-item.id%>'" class="btn btn-primary" style="width:100%">点击评论</button>
                </div>
            </div>
         <%   }) %>
        </div>
    </div>
    <%- include foot %>
    <script>
        function todoSearch(){
            window.location.href = "/movie?keyword="+$("#keyword").val()
        }
    </script>
</body>
</html>